


<template>
  <div class="douyin">

    <div class="center">
      <left></left>
      <div class="right">

        <top></top>
        <div class="hei10"></div>
        <div style="padding: 20px; cursor: pointer;" class="kflexc" @click="$router.back(-1)">
          <i class="el-icon-arrow-left" style="margin-right: 10px;"></i>订单数据统计
        </div>
        <div style="margin: 20px 20px;">
          <div class="kflexbc" style="margin-bottom: 20px; color: #ACACAC; font-size: 14px;">
            <div style="font-size: 14px;">
              <div style="margin-right: 20px;" class="kflexc">
                <el-switch style="margin-right: 20px;" v-model="all.order_quantity_limit_switch" active-color="rgb(8, 201, 160)" inactive-color="rgb(220, 220, 220)" active-value='1' inactive-value='0'></el-switch>
                提单数量限制
              </div>
              <div style="color: #AFAFAF; font-size: 12px; margin: 15px 0;">功能说明：当提单数量达到设置的限制值，则不再继续提单，您可在下方“查看队列”按钮处查看当前卡在队列中的订单，另：该值与转单配置处的勾选“检查提单上限”关联</div>
              <div class="kflexc">
                <div style="color: #565656;">提单数量限制：</div>
                <div><el-input v-model="all.order_quantity_limit" style="width: 150px; margin: 0 20px;" :disabled="all.order_quantity_limit_switch == 0" type="number" placeholder="输入提单数量限制"></el-input></div>
                <div style="margin-right: 20px;">计算时间周期</div>
                <div style="margin-right: 20px;">
                    <el-radio v-model="all.order_quantity_limit_time_cycle" :disabled="all.order_quantity_limit_switch == 0" label="1">天</el-radio>
                    <el-radio v-model="all.order_quantity_limit_time_cycle" :disabled="all.order_quantity_limit_switch == 0" label="2">月</el-radio>

                </div>
              </div>
              <div class="kflexc" style="margin: 15px 0;">
                <div style="color: #565656;">当前受该限制导致无法提单数量</div>
                <div style="color: #FF0000; margin: 0 20px; font-size: 20px;">{{all.channel_order_quantity_limit_count}}</div>
                <div style="color: #0023FF; cursor: pointer;" @click="$router.push('/productionBasismanag/xianzhiqudaoduilie?id='+$route.query.id+'&limit_type=1')">查看队列></div>
              </div>
            </div>

            <div class="hei10"></div>


          </div>
          <div><el-button type="primary" style="margin-bottom: 20px;" round plain @click="baocun()">保存修改</el-button></div>
          <div style="font-size: 18px; margin-bottom: 20px;">提单数据</div>
          <div style="line-height: 50px; width: 430px; color: #565656; font-size: 14px;" >

            <div style="border-bottom: 1px #E4E3E3 solid;" class="kflexc"><div style="width: 50%;">提交成功:</div>{{all.submit_success_count}}</div>
            <div style="border-bottom: 1px #E4E3E3 solid;" class="kflexc"><div style="width: 50%;">提交异常:</div>{{all.submit_fail_count}}</div>

            <div style="border-bottom: 1px #E4E3E3 solid;" class="kflexc"><div style="width: 50%;">省内订单提单成功数:</div>{{all.in_province_submit_success_count}}</div>
            <div style="border-bottom: 1px #E4E3E3 solid;" class="kflexc"><div style="width: 50%;">省外订单提单成功数:</div>{{all.out_province_submit_success_count}}</div>


            <div style="border-bottom: 1px #E4E3E3 solid;" class="kflexc"><div style="width: 50%;">生产异常:</div>{{all.produce_fail_count}}</div>
            <div style="border-bottom: 1px #E4E3E3 solid;" class="kflexc"><div style="width: 50%;">单号回传成功:</div>{{all.callback_success_count}}</div>
            <div style="border-bottom: 1px #E4E3E3 solid;" class="kflexc"><div style="width: 50%;">待回传订单号:</div>{{all.callback_pending_count}}</div>
          </div>
        </div>

      </div>
    </div>

  </div>
</template>

<script>
  import axios from 'axios'
  import top from '@/components/top.vue'
  import left from '@/components/left.vue'
  import foot from '@/components/foot.vue'
  export default {
    components: {
      "left": left,
      "top": top,
      "foot": foot,
    },
    name: 'qudaoguanli',
    data() {
      return {
        form: {
          page: 1,
          pagesize: 20,
        },
        loading: true,
        all: {
          "id": "",
          "shop_id": "",
          "user_id": "",
          "config_type": "", //配置类型
          "product_id": "",
          "channel_id": "",
          "order_quantity_limit_switch": "", //提单数量限制开关
          "order_quantity_limit_time_cycle": "", //提单数量计算时间周期
          "order_quantity_limit": "", //提单数量限制
          "in_province_order_ratio_swtich": "", //省内提单比例开关
          "in_province_order_ratio": "", //省内提单比例
          "in_province_order_time_cycle": "", //省内计算时间周期
          "created_at": "",
          "updated_at": "",
          "submit_total_count": "", //提单总数
          "submit_success_count": "", //提单成功数量
          "submit_fail_count": "", //提单失败数量
          "in_province_submit_success_count": "", //省内提单成功数量
          "out_province_submit_success_count": "", //省外提单成功数量
          "produce_fail_count": "", //生产失败数量
          "callback_success_count": "", //回传成功数量
          "callback_pending_count": "", //带回传数量
          "product_order_quantity_limit_count": "" //产品待提单队列数量
        },
        tableData:""
      }
    },
    created() {
      this.getlist()

    },
    methods: {
      baocun:function(){
        axios.post('/api/product_order_config/store',this.all)
          .then(response => {
            if (response.data.msg.code == 0) {
              this.$message.success('操作成功');
              this.getlist()
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      getlist: function() {
        axios.get('/api/product_order_config/item/channel?channel_id='+this.$route.query.id)
          .then(response => {
            if (response.data.msg.code == 0) {
              this.all = response.data.data
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },



    }
  }
</script>

<style lang="scss" scoped>
 @import url("../../assets/zuixin.scss");
 /deep/ .el-input-group__append{ border: 0;}
</style>
